
package com.ami.kvm.jviewer.kvmpkts;

import com.ami.kvm.jviewer.Debug;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class FragNumReader implements KVMReader {
	private KVMClient m_client;
	private ByteBuffer m_fragNumBuf;
	private int m_fragNumIx;

	public FragNumReader(KVMClient paramKVMClient) {
		this.m_client = paramKVMClient;
		this.m_fragNumBuf = ByteBuffer.allocate(2);
		this.m_fragNumBuf.order(ByteOrder.LITTLE_ENDIAN);
		this.m_fragNumIx = 0;
	}

	public void initialize() {
		this.m_fragNumIx = 0;
		this.m_fragNumBuf.clear();
	}

	public int read(Socket paramSocket) {
		try {
			byte[] arrayOfByte = new byte[this.m_fragNumBuf.remaining()];
			this.m_fragNumIx = this.m_client.read_data(paramSocket, arrayOfByte);
			this.m_fragNumBuf.put(arrayOfByte);

			if (2 <= this.m_fragNumIx) {
				this.m_client.m_fragNum = this.m_fragNumBuf.getShort(0);

				FragReader localFragReader = this.m_client.getFragReader();
				localFragReader.initialize();
				this.m_client.setState(localFragReader);
			}
		} catch (Exception localException) {
			Debug.out.println("ON_READ_FRAG_SZ ");
			Debug.out.println(localException);
			return -1;
		}
		return 0;
	}
}

/*
 * Location:
 * D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\kvmpkts\
 * FragNumReader.class Java compiler version: 5 (49.0) JD-Core Version: 0.7.1
 */